<?php
	include_once("./commonality.php");
	$set="select * from message";
	$res=mysql_query($set);
	session_start();
	
	if(isset($_POST['sub'])){
		if(isset($_SESSION['account'])){
			$account = $_SESSION['account'];
			$mtitle = $_POST['mtitle'];
			$mcontent = strip_tags($_POST['mcontent']);
			$ip = $_SERVER["SERVER_ADDR"];//服务器IP地址
			$time = date("Y-m-d H:i:s",time());
			$id = $_SESSION['id'];
			$lse = "insert into message (mtitle,mcontent,mtime,ip,id)values
				('$mtitle','$mcontent','$time','$ip','$id')";			
				mysql_query($lse);
			if(mysql_affected_rows()>0){
				
				tankuang("发布成功","./forum.php");
			}else{
				tankuang("发布失败","./forum1.php");
				
			}
		}else{
			tankuang("发布失败请先登录","./register1.php");
		}
	};










?>


<!doctype html>
	<html>
		<head>
		<title>发帖</title>
		<meta charset="utf-8">
		</head>
		
	<body>
		<form action="" method="post">
		
		标题<input type="text" name="mtitle" value=""><br>
		
		内容<br>
		<?php
			include_once("./fckeditor/fckeditor.php");
			$fckeditor = new FCKeditor("mcontent");//定义默认值 name
			$fckeditor->Width = "300px";//定义编辑器的宽度
			$fckeditor->Height = "200px";//定义编辑器的高度
			$fckeditor->Value = "";//定义默认值
			$fckeditor->BasePath='./fckeditor/';
			$fckeditor->ToolbarSet = "Basic";
			$fckeditor->Create();//创建编辑器
		?>
		<br>
		<input type="submit" name="sub" value="发贴">
	</body>
	</html>
	